﻿<div>
    <h3>Last Orders</h3>
    <div>
        <a class="btn btn-primary" href="/#order/edit"><i class=" icon-plus"></i></a>
        <a class="btn btn-success" data-bind="visible: includeClosedFlag(), click: changeInclude">Only Pending</a>
        <a class="btn btn-warning" data-bind="visible: !includeClosedFlag(),click: changeInclude">Include Delivered</a>
    </div>
</div>

<table class="table table-hover" data-bind="visible: orders().length > 0">
    <thead>
        <tr>
            <th>Status</th>
            <th>ReferenceId</th>
            <th>Customer</th>
            <th>Total Amount</th>
            <th></th>
        </tr>
    </thead>
    <tbody data-bind="foreach: orders">
        <tr>
            <td>
                <img data-bind="attr:{src: IsPending() ? '/Images/openbox.png' : '/Images/closebox.png'}" alt="" style="width: 80px" />
            </td>
            <td><a data-bind="attr:{href: '/#order/edit/' + Id()}, text: ReferenceId"></a></td>
            <td><a data-bind="attr:{ href: '/#customer/edit/' + Customer().Id()}"><img  data-bind="attr:{src: Customer().ImageUrl }" alt="" style="width: 50px" class="img-polaroid" /></a></td>
            <td><span data-bind="text: TotalAmount() + ' €'"></span></td>
            <td><a data-bind="click: $parent.removeOrder" href=""><i class="icon-trash"></i></a></td>
        </tr>
    </tbody>
</table>
